package com.ruoyi.es.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.es.common.PersonRepositories;
import com.ruoyi.es.domain.SysDept;
import com.ruoyi.es.service.ITestEsService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("/esTest")
@Slf4j
public class TestEsController extends BaseController {
    @Autowired
    ElasticsearchRestTemplate restTemplate;

    @Autowired
    PersonRepositories personRepositories;

    @Autowired
    ITestEsService esService;

    @PostMapping("/testEs")
    public void testEs()
    {
        esService.testEs();
    }


    @PostMapping("/setIndex")
    public AjaxResult setIndex(Map map,String index){
        return success( esService.setIndex(map, index));
    }

}
